<?php

namespace submodule\models;

use Yii;

/**
 * This is the model class for table "mobo_models".
 *
 * @property integer $modelid
 * @property string $name
 * @property string $tablename
 * @property string $setting
 * @property string $param
 * @property string $api
 * @property string $type
 */
class Models extends \base\BaseActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'submodule_models';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
		    [['isdefault', 'deleted'], 'integer'],
            [['setting', 'param', 'api', 'description'], 'string'],
            [['name', 'tablename'], 'string', 'max' => 50],
            [['type'], 'string', 'max' => 10]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'modelid' => 'Modelid',
            'name' => 'Name',
            'tablename' => 'Tablename',
            'setting' => 'Setting',
            'param' => 'Param',
            'api' => 'Api',
            'type' => 'Type',
        ];
    }
	
	public static function formtype($formtype = '')
	{
	    $type = [
		    'primarykey'=> '主键字段',
			'category'=> '分类',
			'text'=> '单行文本',
			'textarea'=> '多行文本',
			'ueditor'=> 'HTML编辑器',
			'switch'=> '开关按钮',
			'radio'=> '单选按钮',
			'checkbox'=> '复选按钮',
			'select'=> '下拉选项',
			'image'=> '上传图片',
			'images'=> '上传多图片',
			'baidumap'=> '百度地图坐标',
			'datetime'=> '日期和时间',
			'upload'=> '文件上传',
			'linkage'=> '联动分类',
			'customize'=> '自定义'
		];
		return $formtype ? $type[$formtype] : $type;
	}
}
